package com.neuedu.action.web;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.neuedu.model.News;
import com.neuedu.service.NewsService;


@Controller
@RequestMapping("/news")
public class NewsWebAction {
	@Autowired
	private NewsService NewsService;
	
	@RequestMapping(value = "/findAll")
	public String findAll(HttpServletRequest request, HttpServletResponse response) throws Exception {
	/*	int page = Integer.parseInt(request.getParameter("page"));
		int rows = Integer.parseInt(request.getParameter("rows"));*/
		Map<String, Object> map = new HashMap<String, Object>();
		Map<String, Object> pageMap = new HashMap<String, Object>();
		pageMap.put("startPage", 0);
		pageMap.put("endPage",7);

		List<News> u = NewsService.findAll(pageMap);
		request.setAttribute("newsList", u);

		return "unews";
	}
}
